package fm.last.api
{
    import fm.last.BaseTC;
    

    public class TrackAPITest extends BaseTC
    {
        
        
        public function TrackAPITest()
        {
            super();
   
            addTest("testAddTags");
            addTest("testBan");
            addTest("testGetInfo");
            addTest("testGetSimilar");
            addTest("testGetTags");
            addTest("testGetTopFans");
            addTest("testGetTopTags");
            addTest("testLove");
            addTest("testRemoveTag");
            addTest("testSearch");
            
            // open the comment  if you want to test it
            //addTest("testShare");                     
        }
     
     
        public function testAddTags():void 
        {
            var getThenRemove:Function = function(xml:XML):void {
                var f:Function = expectedPattern("/lfm/tags", /tk1/);
                f(xml);
                
                lfm_service.track.removeTag(okNoContent, unexpectedError, "Isobel", "Björk", "tk1");
            }
            
            var addThenGet:Function = function(xml:XML):void {
                okNoContent(xml);
                
                lfm_service.track.getTags(getThenRemove,unexpectedError, "Isobel", "Björk");
            }
            lfm_service.track.addTags(okNoContent, unexpectedError, "Isobel", "Björk", "tk1"); 
        }
        
        public function testBan():void 
        {
            lfm_service.track.ban(okNoContent, unexpectedError, "Isobel", "Björk");
        }
        
        public function testGetInfo():void 
        {
            lfm_service.track.getInfo(expectedPattern("/lfm/track/name",/Isobel/),unexpectedError, "Isobel", "Björk");
        }
        
        public function testGetSimilar():void
        {
            lfm_service.track.getSimilar(expectedPattern("/lfm/similartracks"),unexpectedError, "Isobel", "Björk");
        }
        
        /** @see testAddTags */
        public function testGetTags():void {}
        
        public function testGetTopFans():void 
        {
            lfm_service.track.getTopFans(expectedPattern("/lfm/topfans"), unexpectedError, "Isobel", "Björk");
        }
        
        public function testGetTopTags():void 
        {
            lfm_service.track.getTopTags(expectedPattern("/lfm/toptags"), unexpectedError, "Isobel", "Björk");
        }
        
        public function testLove():void 
        {
            lfm_service.track.love(okNoContent, unexpectedError, "Post", "Björk"); 
        }
        
        /** @see testAddTags */
        public function testRemoveTag():void {}
        
        public function testSearch():void 
        {
            lfm_service.track.search(expectedPattern("/lfm/results"), unexpectedError, "Post", "Björk"); 
        }
        
        public function testShare():void 
        {
            lfm_service.track.share(okNoContent, unexpectedError, "Post", "Björk", "vixplore", "test track share");
        }      
    }
}